﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chess
{
    public abstract class Player
    {
        public enum Color{WHITE,BLACK}
        public Color color;
        public Piece pKing;
        public Piece pQueen;
        public Piece pKingPawn;
        public Piece pQueenPawn;
        public Piece pKingRook;
        public Piece pQueenRook;
        public Piece pKingKnight;
        public Piece pQueenKnight;
        public Piece pKingBishop;
        public Piece pQueenBishop;     
        public Pieces filePiece;
        public Pieces pieceCapture;

        public Player()
        {
            filePiece = new Pieces(this);
            pieceCapture = new Pieces(this);          
        }

        public Color isColor
        {
            get {return color;}
            set {color = value;}
        }

        public Pieces Pieces
        {
            get { return filePiece; }
        }


        public Player Other
        {
            get { return this.color == Player.Color.WHITE ? Game.BlackPlayer : Game.WhitePlayer; }
        }

        public Piece King
        {
            get { return pKing;}
            set { pKing = value; }
        }

        public Piece Queen
        {
            get { return pQueen; }
            set { pQueen = value; }
        }

        public Piece KingPawn
        {
            get { return pKingPawn; }
            set { pKingPawn = value; }
        }

        public Piece QueenPawn
        {
            get { return pQueenPawn; }
            set { pQueenPawn = value; }
        }

        public Piece KingRook
        {
            get { return pKingRook; }
            set { pKingRook = value; }
        }

        public Piece QueenRook
        {
            get { return pQueenRook; }
            set { pQueenRook = value; }
        }

        public Piece KingBishop
        {
            get { return pKingBishop; }
            set { pKingBishop = value; }
        }

        public Piece QueenBishop
        {
            get { return pQueenBishop; }
            set { pQueenBishop = value; }
        }

        public Piece KingKnight
        {
            get { return pKingKnight; }
            set { pKingKnight = value; }
        }

        public Piece QueenKnight
        {
            get { return pQueenKnight; }
            set { pQueenKnight = value; }
        }

        public void ValidMove(Moves moves)
        {
            foreach (Piece piece in filePiece)
                piece.ValidMove(moves);            
        }
        
        public abstract int PawnForwardOffset
        {
            get;
        }

        public abstract int PawnAttackLeftOffset
        {
            get;
        }

        public abstract int PawnAttackRightOffset
        {
            get;
        }        
    }
}
